<!doctype html>

<html>
<head>
  <link rel="shortcut icon" href="static/images/favicon.ico" type="image/x-icon">
  <title>vec3f.js (Closure Library API Documentation - JavaScript)</title>
  <link rel="stylesheet" href="static/css/base.css">
  <link rel="stylesheet" href="static/css/doc.css">
  <link rel="stylesheet" href="static/css/sidetree.css">
  <link rel="stylesheet" href="static/css/prettify.css">

  <script>
     var _staticFilePath = "static/";
     var _typeTreeName = "goog";
     var _fileTreeName = "Source";
  </script>

  <script src="static/js/doc.js">
  </script>


  <meta charset="utf8">
</head>

<body onload="grokdoc.onLoad();">

<div id="header">
  <div class="g-section g-tpl-50-50 g-split">
    <div class="g-unit g-first">
      <a id="logo" href="index.html">Closure Library API Documentation</a>
    </div>

    <div class="g-unit">
      <div class="g-c">
        <strong>Go to class or file:</strong>
        <input type="text" id="ac">
      </div>
    </div>
  </div>
</div>

<div class="clear"></div>

<h2><a href="local_closure_goog_vec_vec3f.js.html">vec3f.js</a></h2>

<pre class="prettyprint lang-js">
<a name="line1"></a>// Copyright 2013 The Closure Library Authors. All Rights Reserved.
<a name="line2"></a>//
<a name="line3"></a>// Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
<a name="line4"></a>// you may not use this file except in compliance with the License.
<a name="line5"></a>// You may obtain a copy of the License at
<a name="line6"></a>//
<a name="line7"></a>//      http://www.apache.org/licenses/LICENSE-2.0
<a name="line8"></a>//
<a name="line9"></a>// Unless required by applicable law or agreed to in writing, software
<a name="line10"></a>// distributed under the License is distributed on an &quot;AS-IS&quot; BASIS,
<a name="line11"></a>// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<a name="line12"></a>// See the License for the specific language governing permissions and
<a name="line13"></a>// limitations under the License.
<a name="line14"></a>
<a name="line15"></a>
<a name="line16"></a>////////////////////////// NOTE ABOUT EDITING THIS FILE ///////////////////////
<a name="line17"></a>//                                                                           //
<a name="line18"></a>// Any edits to this file must be applied to vec3d.js by running:            //
<a name="line19"></a>//   swap_type.sh vec3f.js &gt; vec3d.js                                        //
<a name="line20"></a>//                                                                           //
<a name="line21"></a>////////////////////////// NOTE ABOUT EDITING THIS FILE ///////////////////////
<a name="line22"></a>
<a name="line23"></a>
<a name="line24"></a>/**
<a name="line25"></a> * @fileoverview Provides functions for operating on 3 element float (32bit)
<a name="line26"></a> * vectors.
<a name="line27"></a> *
<a name="line28"></a> * The last parameter will typically be the output object and an object
<a name="line29"></a> * can be both an input and output parameter to all methods except where
<a name="line30"></a> * noted.
<a name="line31"></a> *
<a name="line32"></a> * See the README for notes about the design and structure of the API
<a name="line33"></a> * (especially related to performance).
<a name="line34"></a> *
<a name="line35"></a> */
<a name="line36"></a>goog.provide(&#39;goog.vec.vec3f&#39;);
<a name="line37"></a>goog.provide(&#39;goog.vec.vec3f.Type&#39;);
<a name="line38"></a>
<a name="line39"></a>/** @suppress {extraRequire} */
<a name="line40"></a>goog.require(&#39;goog.vec&#39;);
<a name="line41"></a>
<a name="line42"></a>/** @typedef {goog.vec.Float32} */ goog.vec.vec3f.Type;
<a name="line43"></a>
<a name="line44"></a>
<a name="line45"></a>/**
<a name="line46"></a> * Creates a vec3f with all elements initialized to zero.
<a name="line47"></a> *
<a name="line48"></a> * @return {!goog.vec.vec3f.Type} The new vec3f.
<a name="line49"></a> */
<a name="line50"></a>goog.vec.vec3f.create = function() {
<a name="line51"></a>  return new Float32Array(3);
<a name="line52"></a>};
<a name="line53"></a>
<a name="line54"></a>
<a name="line55"></a>/**
<a name="line56"></a> * Initializes the vector with the given values.
<a name="line57"></a> *
<a name="line58"></a> * @param {goog.vec.vec3f.Type} vec The vector to receive the values.
<a name="line59"></a> * @param {number} v0 The value for element at index 0.
<a name="line60"></a> * @param {number} v1 The value for element at index 1.
<a name="line61"></a> * @param {number} v2 The value for element at index 2.
<a name="line62"></a> * @return {!goog.vec.vec3f.Type} Return vec so that operations can be
<a name="line63"></a> *     chained together.
<a name="line64"></a> */
<a name="line65"></a>goog.vec.vec3f.setFromValues = function(vec, v0, v1, v2) {
<a name="line66"></a>  vec[0] = v0;
<a name="line67"></a>  vec[1] = v1;
<a name="line68"></a>  vec[2] = v2;
<a name="line69"></a>  return vec;
<a name="line70"></a>};
<a name="line71"></a>
<a name="line72"></a>
<a name="line73"></a>/**
<a name="line74"></a> * Initializes vec3f vec from vec3f src.
<a name="line75"></a> *
<a name="line76"></a> * @param {goog.vec.vec3f.Type} vec The destination vector.
<a name="line77"></a> * @param {goog.vec.vec3f.Type} src The source vector.
<a name="line78"></a> * @return {!goog.vec.vec3f.Type} Return vec so that operations can be
<a name="line79"></a> *     chained together.
<a name="line80"></a> */
<a name="line81"></a>goog.vec.vec3f.setFromVec3f = function(vec, src) {
<a name="line82"></a>  vec[0] = src[0];
<a name="line83"></a>  vec[1] = src[1];
<a name="line84"></a>  vec[2] = src[2];
<a name="line85"></a>  return vec;
<a name="line86"></a>};
<a name="line87"></a>
<a name="line88"></a>
<a name="line89"></a>/**
<a name="line90"></a> * Initializes vec3f vec from vec3d src (typed as a Float64Array to
<a name="line91"></a> * avoid circular goog.requires).
<a name="line92"></a> *
<a name="line93"></a> * @param {goog.vec.vec3f.Type} vec The destination vector.
<a name="line94"></a> * @param {Float64Array} src The source vector.
<a name="line95"></a> * @return {!goog.vec.vec3f.Type} Return vec so that operations can be
<a name="line96"></a> *     chained together.
<a name="line97"></a> */
<a name="line98"></a>goog.vec.vec3f.setFromVec3d = function(vec, src) {
<a name="line99"></a>  vec[0] = src[0];
<a name="line100"></a>  vec[1] = src[1];
<a name="line101"></a>  vec[2] = src[2];
<a name="line102"></a>  return vec;
<a name="line103"></a>};
<a name="line104"></a>
<a name="line105"></a>
<a name="line106"></a>/**
<a name="line107"></a> * Initializes vec3f vec from Array src.
<a name="line108"></a> *
<a name="line109"></a> * @param {goog.vec.vec3f.Type} vec The destination vector.
<a name="line110"></a> * @param {Array.&lt;number&gt;} src The source vector.
<a name="line111"></a> * @return {!goog.vec.vec3f.Type} Return vec so that operations can be
<a name="line112"></a> *     chained together.
<a name="line113"></a> */
<a name="line114"></a>goog.vec.vec3f.setFromArray = function(vec, src) {
<a name="line115"></a>  vec[0] = src[0];
<a name="line116"></a>  vec[1] = src[1];
<a name="line117"></a>  vec[2] = src[2];
<a name="line118"></a>  return vec;
<a name="line119"></a>};
<a name="line120"></a>
<a name="line121"></a>
<a name="line122"></a>/**
<a name="line123"></a> * Performs a component-wise addition of vec0 and vec1 together storing the
<a name="line124"></a> * result into resultVec.
<a name="line125"></a> *
<a name="line126"></a> * @param {goog.vec.vec3f.Type} vec0 The first addend.
<a name="line127"></a> * @param {goog.vec.vec3f.Type} vec1 The second addend.
<a name="line128"></a> * @param {goog.vec.vec3f.Type} resultVec The vector to
<a name="line129"></a> *     receive the result. May be vec0 or vec1.
<a name="line130"></a> * @return {!goog.vec.vec3f.Type} Return resultVec so that operations can be
<a name="line131"></a> *     chained together.
<a name="line132"></a> */
<a name="line133"></a>goog.vec.vec3f.add = function(vec0, vec1, resultVec) {
<a name="line134"></a>  resultVec[0] = vec0[0] + vec1[0];
<a name="line135"></a>  resultVec[1] = vec0[1] + vec1[1];
<a name="line136"></a>  resultVec[2] = vec0[2] + vec1[2];
<a name="line137"></a>  return resultVec;
<a name="line138"></a>};
<a name="line139"></a>
<a name="line140"></a>
<a name="line141"></a>/**
<a name="line142"></a> * Performs a component-wise subtraction of vec1 from vec0 storing the
<a name="line143"></a> * result into resultVec.
<a name="line144"></a> *
<a name="line145"></a> * @param {goog.vec.vec3f.Type} vec0 The minuend.
<a name="line146"></a> * @param {goog.vec.vec3f.Type} vec1 The subtrahend.
<a name="line147"></a> * @param {goog.vec.vec3f.Type} resultVec The vector to
<a name="line148"></a> *     receive the result. May be vec0 or vec1.
<a name="line149"></a> * @return {!goog.vec.vec3f.Type} Return resultVec so that operations can be
<a name="line150"></a> *     chained together.
<a name="line151"></a> */
<a name="line152"></a>goog.vec.vec3f.subtract = function(vec0, vec1, resultVec) {
<a name="line153"></a>  resultVec[0] = vec0[0] - vec1[0];
<a name="line154"></a>  resultVec[1] = vec0[1] - vec1[1];
<a name="line155"></a>  resultVec[2] = vec0[2] - vec1[2];
<a name="line156"></a>  return resultVec;
<a name="line157"></a>};
<a name="line158"></a>
<a name="line159"></a>
<a name="line160"></a>/**
<a name="line161"></a> * Negates vec0, storing the result into resultVec.
<a name="line162"></a> *
<a name="line163"></a> * @param {goog.vec.vec3f.Type} vec0 The vector to negate.
<a name="line164"></a> * @param {goog.vec.vec3f.Type} resultVec The vector to
<a name="line165"></a> *     receive the result. May be vec0.
<a name="line166"></a> * @return {!goog.vec.vec3f.Type} Return resultVec so that operations can be
<a name="line167"></a> *     chained together.
<a name="line168"></a> */
<a name="line169"></a>goog.vec.vec3f.negate = function(vec0, resultVec) {
<a name="line170"></a>  resultVec[0] = -vec0[0];
<a name="line171"></a>  resultVec[1] = -vec0[1];
<a name="line172"></a>  resultVec[2] = -vec0[2];
<a name="line173"></a>  return resultVec;
<a name="line174"></a>};
<a name="line175"></a>
<a name="line176"></a>
<a name="line177"></a>/**
<a name="line178"></a> * Takes the absolute value of each component of vec0 storing the result in
<a name="line179"></a> * resultVec.
<a name="line180"></a> *
<a name="line181"></a> * @param {goog.vec.vec3f.Type} vec0 The source vector.
<a name="line182"></a> * @param {goog.vec.vec3f.Type} resultVec The vector to receive the result.
<a name="line183"></a> *     May be vec0.
<a name="line184"></a> * @return {!goog.vec.vec3f.Type} Return resultVec so that operations can be
<a name="line185"></a> *     chained together.
<a name="line186"></a> */
<a name="line187"></a>goog.vec.vec3f.abs = function(vec0, resultVec) {
<a name="line188"></a>  resultVec[0] = Math.abs(vec0[0]);
<a name="line189"></a>  resultVec[1] = Math.abs(vec0[1]);
<a name="line190"></a>  resultVec[2] = Math.abs(vec0[2]);
<a name="line191"></a>  return resultVec;
<a name="line192"></a>};
<a name="line193"></a>
<a name="line194"></a>
<a name="line195"></a>/**
<a name="line196"></a> * Multiplies each component of vec0 with scalar storing the product into
<a name="line197"></a> * resultVec.
<a name="line198"></a> *
<a name="line199"></a> * @param {goog.vec.vec3f.Type} vec0 The source vector.
<a name="line200"></a> * @param {number} scalar The value to multiply with each component of vec0.
<a name="line201"></a> * @param {goog.vec.vec3f.Type} resultVec The vector to
<a name="line202"></a> *     receive the result. May be vec0.
<a name="line203"></a> * @return {!goog.vec.vec3f.Type} Return resultVec so that operations can be
<a name="line204"></a> *     chained together.
<a name="line205"></a> */
<a name="line206"></a>goog.vec.vec3f.scale = function(vec0, scalar, resultVec) {
<a name="line207"></a>  resultVec[0] = vec0[0] * scalar;
<a name="line208"></a>  resultVec[1] = vec0[1] * scalar;
<a name="line209"></a>  resultVec[2] = vec0[2] * scalar;
<a name="line210"></a>  return resultVec;
<a name="line211"></a>};
<a name="line212"></a>
<a name="line213"></a>
<a name="line214"></a>/**
<a name="line215"></a> * Returns the magnitudeSquared of the given vector.
<a name="line216"></a> *
<a name="line217"></a> * @param {goog.vec.vec3f.Type} vec0 The vector.
<a name="line218"></a> * @return {number} The magnitude of the vector.
<a name="line219"></a> */
<a name="line220"></a>goog.vec.vec3f.magnitudeSquared = function(vec0) {
<a name="line221"></a>  var x = vec0[0], y = vec0[1], z = vec0[2];
<a name="line222"></a>  return x * x + y * y + z * z;
<a name="line223"></a>};
<a name="line224"></a>
<a name="line225"></a>
<a name="line226"></a>/**
<a name="line227"></a> * Returns the magnitude of the given vector.
<a name="line228"></a> *
<a name="line229"></a> * @param {goog.vec.vec3f.Type} vec0 The vector.
<a name="line230"></a> * @return {number} The magnitude of the vector.
<a name="line231"></a> */
<a name="line232"></a>goog.vec.vec3f.magnitude = function(vec0) {
<a name="line233"></a>  var x = vec0[0], y = vec0[1], z = vec0[2];
<a name="line234"></a>  return Math.sqrt(x * x + y * y + z * z);
<a name="line235"></a>};
<a name="line236"></a>
<a name="line237"></a>
<a name="line238"></a>/**
<a name="line239"></a> * Normalizes the given vector storing the result into resultVec.
<a name="line240"></a> *
<a name="line241"></a> * @param {goog.vec.vec3f.Type} vec0 The vector to normalize.
<a name="line242"></a> * @param {goog.vec.vec3f.Type} resultVec The vector to
<a name="line243"></a> *     receive the result. May be vec0.
<a name="line244"></a> * @return {!goog.vec.vec3f.Type} Return resultVec so that operations can be
<a name="line245"></a> *     chained together.
<a name="line246"></a> */
<a name="line247"></a>goog.vec.vec3f.normalize = function(vec0, resultVec) {
<a name="line248"></a>  var x = vec0[0], y = vec0[1], z = vec0[2];
<a name="line249"></a>  var ilen = 1 / Math.sqrt(x * x + y * y + z * z);
<a name="line250"></a>  resultVec[0] = x * ilen;
<a name="line251"></a>  resultVec[1] = y * ilen;
<a name="line252"></a>  resultVec[2] = z * ilen;
<a name="line253"></a>  return resultVec;
<a name="line254"></a>};
<a name="line255"></a>
<a name="line256"></a>
<a name="line257"></a>/**
<a name="line258"></a> * Returns the scalar product of vectors v0 and v1.
<a name="line259"></a> *
<a name="line260"></a> * @param {goog.vec.vec3f.Type} v0 The first vector.
<a name="line261"></a> * @param {goog.vec.vec3f.Type} v1 The second vector.
<a name="line262"></a> * @return {number} The scalar product.
<a name="line263"></a> */
<a name="line264"></a>goog.vec.vec3f.dot = function(v0, v1) {
<a name="line265"></a>  return v0[0] * v1[0] + v0[1] * v1[1] + v0[2] * v1[2];
<a name="line266"></a>};
<a name="line267"></a>
<a name="line268"></a>
<a name="line269"></a>/**
<a name="line270"></a> * Computes the vector (cross) product of v0 and v1 storing the result into
<a name="line271"></a> * resultVec.
<a name="line272"></a> *
<a name="line273"></a> * @param {goog.vec.vec3f.Type} v0 The first vector.
<a name="line274"></a> * @param {goog.vec.vec3f.Type} v1 The second vector.
<a name="line275"></a> * @param {goog.vec.vec3f.Type} resultVec The vector to receive the
<a name="line276"></a> *     results. May be either v0 or v1.
<a name="line277"></a> * @return {!goog.vec.vec3f.Type} Return resultVec so that operations can be
<a name="line278"></a> *     chained together.
<a name="line279"></a> */
<a name="line280"></a>goog.vec.vec3f.cross = function(v0, v1, resultVec) {
<a name="line281"></a>  var x0 = v0[0], y0 = v0[1], z0 = v0[2];
<a name="line282"></a>  var x1 = v1[0], y1 = v1[1], z1 = v1[2];
<a name="line283"></a>  resultVec[0] = y0 * z1 - z0 * y1;
<a name="line284"></a>  resultVec[1] = z0 * x1 - x0 * z1;
<a name="line285"></a>  resultVec[2] = x0 * y1 - y0 * x1;
<a name="line286"></a>  return resultVec;
<a name="line287"></a>};
<a name="line288"></a>
<a name="line289"></a>
<a name="line290"></a>/**
<a name="line291"></a> * Returns the squared distance between two points.
<a name="line292"></a> *
<a name="line293"></a> * @param {goog.vec.vec3f.Type} vec0 First point.
<a name="line294"></a> * @param {goog.vec.vec3f.Type} vec1 Second point.
<a name="line295"></a> * @return {number} The squared distance between the points.
<a name="line296"></a> */
<a name="line297"></a>goog.vec.vec3f.distanceSquared = function(vec0, vec1) {
<a name="line298"></a>  var x = vec0[0] - vec1[0];
<a name="line299"></a>  var y = vec0[1] - vec1[1];
<a name="line300"></a>  var z = vec0[2] - vec1[2];
<a name="line301"></a>  return x * x + y * y + z * z;
<a name="line302"></a>};
<a name="line303"></a>
<a name="line304"></a>
<a name="line305"></a>/**
<a name="line306"></a> * Returns the distance between two points.
<a name="line307"></a> *
<a name="line308"></a> * @param {goog.vec.vec3f.Type} vec0 First point.
<a name="line309"></a> * @param {goog.vec.vec3f.Type} vec1 Second point.
<a name="line310"></a> * @return {number} The distance between the points.
<a name="line311"></a> */
<a name="line312"></a>goog.vec.vec3f.distance = function(vec0, vec1) {
<a name="line313"></a>  return Math.sqrt(goog.vec.vec3f.distanceSquared(vec0, vec1));
<a name="line314"></a>};
<a name="line315"></a>
<a name="line316"></a>
<a name="line317"></a>/**
<a name="line318"></a> * Returns a unit vector pointing from one point to another.
<a name="line319"></a> * If the input points are equal then the result will be all zeros.
<a name="line320"></a> *
<a name="line321"></a> * @param {goog.vec.vec3f.Type} vec0 Origin point.
<a name="line322"></a> * @param {goog.vec.vec3f.Type} vec1 Target point.
<a name="line323"></a> * @param {goog.vec.vec3f.Type} resultVec The vector to receive the
<a name="line324"></a> *     results (may be vec0 or vec1).
<a name="line325"></a> * @return {!goog.vec.vec3f.Type} Return resultVec so that operations can be
<a name="line326"></a> *     chained together.
<a name="line327"></a> */
<a name="line328"></a>goog.vec.vec3f.direction = function(vec0, vec1, resultVec) {
<a name="line329"></a>  var x = vec1[0] - vec0[0];
<a name="line330"></a>  var y = vec1[1] - vec0[1];
<a name="line331"></a>  var z = vec1[2] - vec0[2];
<a name="line332"></a>  var d = Math.sqrt(x * x + y * y + z * z);
<a name="line333"></a>  if (d) {
<a name="line334"></a>    d = 1 / d;
<a name="line335"></a>    resultVec[0] = x * d;
<a name="line336"></a>    resultVec[1] = y * d;
<a name="line337"></a>    resultVec[2] = z * d;
<a name="line338"></a>  } else {
<a name="line339"></a>    resultVec[0] = resultVec[1] = resultVec[2] = 0;
<a name="line340"></a>  }
<a name="line341"></a>  return resultVec;
<a name="line342"></a>};
<a name="line343"></a>
<a name="line344"></a>
<a name="line345"></a>/**
<a name="line346"></a> * Linearly interpolate from vec0 to v1 according to f. The value of f should be
<a name="line347"></a> * in the range [0..1] otherwise the results are undefined.
<a name="line348"></a> *
<a name="line349"></a> * @param {goog.vec.vec3f.Type} v0 The first vector.
<a name="line350"></a> * @param {goog.vec.vec3f.Type} v1 The second vector.
<a name="line351"></a> * @param {number} f The interpolation factor.
<a name="line352"></a> * @param {goog.vec.vec3f.Type} resultVec The vector to receive the
<a name="line353"></a> *     results (may be v0 or v1).
<a name="line354"></a> * @return {!goog.vec.vec3f.Type} Return resultVec so that operations can be
<a name="line355"></a> *     chained together.
<a name="line356"></a> */
<a name="line357"></a>goog.vec.vec3f.lerp = function(v0, v1, f, resultVec) {
<a name="line358"></a>  var x = v0[0], y = v0[1], z = v0[2];
<a name="line359"></a>  resultVec[0] = (v1[0] - x) * f + x;
<a name="line360"></a>  resultVec[1] = (v1[1] - y) * f + y;
<a name="line361"></a>  resultVec[2] = (v1[2] - z) * f + z;
<a name="line362"></a>  return resultVec;
<a name="line363"></a>};
<a name="line364"></a>
<a name="line365"></a>
<a name="line366"></a>/**
<a name="line367"></a> * Compares the components of vec0 with the components of another vector or
<a name="line368"></a> * scalar, storing the larger values in resultVec.
<a name="line369"></a> *
<a name="line370"></a> * @param {goog.vec.vec3f.Type} vec0 The source vector.
<a name="line371"></a> * @param {goog.vec.vec3f.Type|number} limit The limit vector or scalar.
<a name="line372"></a> * @param {goog.vec.vec3f.Type} resultVec The vector to receive the
<a name="line373"></a> *     results (may be vec0 or limit).
<a name="line374"></a> * @return {!goog.vec.vec3f.Type} Return resultVec so that operations can be
<a name="line375"></a> *     chained together.
<a name="line376"></a> */
<a name="line377"></a>goog.vec.vec3f.max = function(vec0, limit, resultVec) {
<a name="line378"></a>  if (goog.isNumber(limit)) {
<a name="line379"></a>    resultVec[0] = Math.max(vec0[0], limit);
<a name="line380"></a>    resultVec[1] = Math.max(vec0[1], limit);
<a name="line381"></a>    resultVec[2] = Math.max(vec0[2], limit);
<a name="line382"></a>  } else {
<a name="line383"></a>    resultVec[0] = Math.max(vec0[0], limit[0]);
<a name="line384"></a>    resultVec[1] = Math.max(vec0[1], limit[1]);
<a name="line385"></a>    resultVec[2] = Math.max(vec0[2], limit[2]);
<a name="line386"></a>  }
<a name="line387"></a>  return resultVec;
<a name="line388"></a>};
<a name="line389"></a>
<a name="line390"></a>
<a name="line391"></a>/**
<a name="line392"></a> * Compares the components of vec0 with the components of another vector or
<a name="line393"></a> * scalar, storing the smaller values in resultVec.
<a name="line394"></a> *
<a name="line395"></a> * @param {goog.vec.vec3f.Type} vec0 The source vector.
<a name="line396"></a> * @param {goog.vec.vec3f.Type|number} limit The limit vector or scalar.
<a name="line397"></a> * @param {goog.vec.vec3f.Type} resultVec The vector to receive the
<a name="line398"></a> *     results (may be vec0 or limit).
<a name="line399"></a> * @return {!goog.vec.vec3f.Type} Return resultVec so that operations can be
<a name="line400"></a> *     chained together.
<a name="line401"></a> */
<a name="line402"></a>goog.vec.vec3f.min = function(vec0, limit, resultVec) {
<a name="line403"></a>  if (goog.isNumber(limit)) {
<a name="line404"></a>    resultVec[0] = Math.min(vec0[0], limit);
<a name="line405"></a>    resultVec[1] = Math.min(vec0[1], limit);
<a name="line406"></a>    resultVec[2] = Math.min(vec0[2], limit);
<a name="line407"></a>  } else {
<a name="line408"></a>    resultVec[0] = Math.min(vec0[0], limit[0]);
<a name="line409"></a>    resultVec[1] = Math.min(vec0[1], limit[1]);
<a name="line410"></a>    resultVec[2] = Math.min(vec0[2], limit[2]);
<a name="line411"></a>  }
<a name="line412"></a>  return resultVec;
<a name="line413"></a>};
<a name="line414"></a>
<a name="line415"></a>
<a name="line416"></a>/**
<a name="line417"></a> * Returns true if the components of v0 are equal to the components of v1.
<a name="line418"></a> *
<a name="line419"></a> * @param {goog.vec.vec3f.Type} v0 The first vector.
<a name="line420"></a> * @param {goog.vec.vec3f.Type} v1 The second vector.
<a name="line421"></a> * @return {boolean} True if the vectors are equal, false otherwise.
<a name="line422"></a> */
<a name="line423"></a>goog.vec.vec3f.equals = function(v0, v1) {
<a name="line424"></a>  return v0.length == v1.length &amp;&amp;
<a name="line425"></a>      v0[0] == v1[0] &amp;&amp; v0[1] == v1[1] &amp;&amp; v0[2] == v1[2];
<a name="line426"></a>};
</pre>


</body>
</html>
